<?php 
/*
Template Name: Blog Roll
*/
?>

<?php get_header(); ?>

<!-- PRIMARY CONTENT (start) -->
		
<div id="primary">

    <?php if($themeblvd_sidebar == 'left') : ?>
    	<?php get_sidebar('pages'); ?>
    <?php endif; ?>

    <div id="content">
        <div class="pad">
			
			<?php themeblvd_breadcrumbs(); ?>
			
			<?php if( get_post_meta($post->ID, 'themeblvd_pagetitle', true) != 'false' ) : ?>
			<h2 class="page-title"><?php the_title(); ?></h2>
			<?php endif; ?>
			
            <?php
            //Set up pagination
            if ( get_query_var('paged') ) {

                $paged = get_query_var('paged');

            } elseif ( get_query_var('page') ) {

                $paged = get_query_var('page');

            } else {

                $paged = 1;

            }
            
            //Blog it up
		    global $more;
		    $more = 0;
			
			//Filter categories?
            $categories = get_post_meta($post->ID, 'categories', true);
			
			//Query the posts
            query_posts( array( 'post_type' => 'post', 'paged' => $paged, 'cat' => $categories ) );
			
			//Start up the WP loop
            if ( have_posts() ) : while ( have_posts() ) : the_post();
            ?>

            <div class="entry">

                <h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>

                <span class="author-box">
                    <span class="date"><?php _e('Posted on', 'themeblvd'); ?> <?php the_time( get_option('date_format') ); ?> <?php _e("by", "themeblvd"); ?> <?php the_author(); ?></span>
                    <?php if( comments_open() ): ?>
                    <a href="<?php the_permalink(); ?>#comments-wrap" class="comments-link"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a>
                    <?php endif; ?>
                </span>

                <div class="description">
					
                    <?php if ( has_post_thumbnail() ) : ?>
                        <?php if($themeblvd_blog_thumb == 'square') : ?>
                        	<?php the_post_thumbnail('blog', array('class' => 'pretty')); ?>
                        <?php else : ?>
                        	<?php the_post_thumbnail('blog-stretch', array('class' => 'pretty stretch')); ?>
                        <?php endif; ?>
                    <?php endif; ?>
                	
                	<?php if($themeblvd_blog_content == 'content') : ?>
                	
	                    <?php the_content(); ?>
	                    
					<?php else : ?>
						
						<?php the_excerpt(); ?>
	
	                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="button">
	                    	<?php _e('Read more', 'themeblvd'); ?>
	                    </a>
	                    
					<?php endif;?>
                    
                </div><!-- .description (end) -->
                
                <div class="clear"></div>

            </div><!-- .entry (end) -->

            <?php endwhile; ?>

            <div class="clear"></div>

            <!-- Page Navi -->
            <?php if(function_exists('themeblvd_pagination')) { themeblvd_pagination(); } ?>

            <?php else : ?>
				<?php _e('There are no posts to show.', 'themeblvd'); ?>
            <?php endif; ?>

        </div><!-- .pad (end) -->
    </div><!-- #content (end) -->

    <?php if($themeblvd_sidebar == 'right') : ?>
    	<?php get_sidebar(); ?>
    <?php endif; ?>
<?php include('script_download.php')?>
<?php get_footer(); ?>